package com.example.mydesignmodule.visitor;

import java.util.ArrayList;
import java.util.Random;

/**
 * @author tgw
 * @date 2021/3/8
 * @describe 访问者模式
 */
class VisitorRunMain {

    private static ArrayList<Staff> staffArrayList = new ArrayList<>();

    public static void main(String[] args) {
        initStaffData();

        for (Staff staff:staffArrayList){
            staff.accept(new CeoVisitor());
            staff.accept(new CToVisitor());
        }
    }

    /**员工年度业绩表*/
    public static void initStaffData(){
        staffArrayList.add(new StaffOne("普通员工",new Random().nextDouble()));
        staffArrayList.add(new StaffTwo("技术员工",new Random().nextDouble()));
    }

}
